home *** CD-ROM | disk | FTP | other *** search
/ Programmer Power Tools / Programmer Power Tools.iso / progjrn / pj_6_6.arc / 66L4.ASM < prev    next >
Assembly Source File  |  1988-08-17  |  2KB  |  88 lines

  1. ;
  2. ; *** Listing 4 ***
  3. ;
  4. ; Program to demonstrate screen blanking via bit 5 of the
  5. ; Attribute Controller Index register.
  6. ;
  7. AC_INDEX    equ    3c0h    ;Attribute Controller Index register
  8. INPUT_STATUS_1    equ    3dah    ;color-mode address of the Input
  9.                 ; Status 1 register
  10. ;
  11. ; Macro to wait for and clear the next keypress.
  12. ;
  13. WAIT_KEY    macro
  14.     mov    ah,8    ;DOS input without echo function
  15.     int    21h
  16.     endm
  17. ;
  18. stack    segment para stack 'STACK'
  19.     db    512 dup (?)
  20. stack    ends
  21. ;
  22. Data    segment    word 'DATA'
  23. SampleText db    'This is bit-mapped text, drawn in hi-res '
  24.     db    'EGA graphics mode 10h.', 0dh, 0ah, 0ah
  25.     db    'Press any key to blank the screen, then '
  26.     db    'any key to unblank it,', 0dh, 0ah
  27.     db    'then any key to end.$'
  28. Data    ends
  29. ;
  30. Code    segment
  31.     assume    cs:Code, ds:Data
  32. Start    proc    near
  33.     mov    ax,Data
  34.     mov    ds,ax
  35. ;
  36. ; Go to hi-res graphics mode.
  37. ;
  38.     mov    ax,10h    ;AH = 0 means mode set, AL = 10h selects
  39.             ; hi-res graphics mode
  40.     int    10h    ;BIOS video interrupt
  41. ;
  42. ; Put up some text, so the screen isn't empty.
  43. ;
  44.     mov    ah,9    ;DOS print string function
  45.     mov    dx,offset SampleText
  46.     int    21h
  47. ;
  48.     WAIT_KEY
  49. ;
  50. ; Blank the screen.
  51. ;
  52.     mov    dx,INPUT_STATUS_1
  53.     in    al,dx    ;reset port 3c0h to index (rather than data)
  54.             ; mode
  55.     mov    dx,AC_INDEX
  56.     sub    al,al    ;make bit 5 zero...
  57.     out    dx,al    ;...which blanks the screen
  58. ;
  59.     WAIT_KEY
  60. ;
  61. ; Unblank the screen.
  62. ;
  63.     mov    dx,INPUT_STATUS_1
  64.     in    al,dx    ;reset port 3c0h to Index (rather than data)
  65.             ; mode
  66.     mov    dx,AC_INDEX
  67.     mov    al,20h    ;make bit 5 one...
  68.     out    dx,al    ;...which unblanks the screen
  69. ;
  70.     WAIT_KEY
  71. ;
  72. ; Restore text mode.
  73. ;
  74.     mov    ax,2
  75.     int    10h
  76. ;
  77. ; Done.
  78. ;
  79. Done:
  80.     mov    ah,4ch    ;DOS terminate function
  81.     int    21h
  82. Start    endp
  83. Code    ends
  84.     end    Start
  85.  
  86.  
  87.  
  88.